<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%     
	String path = request.getContextPath();     
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";     
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>查看bug</title>
    <base href="<%=basePath%>"/>
    <%@ include file="../../cuv_include.jsp"%>
    <link rel="stylesheet" href="<%=basePath%>/js/uploadify/css/uploadify.css" type="text/css"></link>
    <script type="text/javascript" src="<%=basePath%>/js/uploadify/jquery.uploadify-3.1.min.js"></script>
    <link rel="stylesheet" href="<%=basePath%>/js/lightbox/css/lightbox.css" type="text/css" />
    <script type="text/javascript" src="<%=basePath%>/js/lightbox/jquery.lightbox.js"></script>
    <style type="text/css">
  		fieldset,legend,form,table,tr,td,textarea{margin:0;padding:0}
  		form label {font-weight:bold;}
    	table{margin:10px 10px};
  		td{line-height: 40px;}
		input[type="text"]{width:250px;}
		input[type="password"]{width:250px;}
		input[type="textarea"]{width:250px;}   		
    </style>
  </head>
  <script type="text/javascript">
	  //返回列表页面
	  function btn_return(){
		 var qs = $("#qs").val();
 	     location.href = "<%=basePath%>soft/bug/list.do?" + qs;
	  }
	  
	  //删除文件
	   function del(row,id,path) {
			if(confirm("确定删除该文件吗？")) {
				$.get("<%=basePath%>soft/bug/deleteFile.do", {id:id,path:path}, function(data) {
					var result = $.parseJSON(data);
					if(result.code == 1) {
						delRow(row);
					} else {
						alert(result.msg);
					}
				});
			}
	   }
	   //删除行
	   function delRow(row)   
	   {   
		    $(row).parent("td").parent("tr").remove();   
	   }  
	  $(".lightbox").lightbox({
			fitToScreen : true,
			scaleImages : true,
			xScale : 1.2,
			fileLoadingImage : '<%=basePath%>/js/lightbox/images/loading.gif', //加载时图片
			fileBottomNavCloseImage : '<%=basePath%>/js/lightbox/images/closelabel.gif', //关闭图片
			yScale : 1.2
	  });
  </script>
  <body>
  <div>
    <fieldset>
      <legend>详细信息：</legend>  
        <table>
            <tr>
			    <td><label for="project">所属项目：</label>
			        <input id="qs" name="qs" type="hidden" value="${qs}"/>
			    </td>
			    <td><input type="text"  value="${project.name}" disabled="disabled" /></td>
		    </tr>
            <tr>
				<td><label for="title">摘要：</label></td>
				<td><input type="text"   disabled="disabled"  value="${bug.title}" />
				</td>
			</tr>
			<tr>
		     	<td><label>添写人：</label></td>
				<td><input type="text" disabled="disabled" value="${bug.subCnname}"/></td>
			</tr>
			<tr>
				<td><label for="moduleId">模块：</label></td>
				<td>
				  <c:forEach items="${moduleList}" var="m" >
		            <c:if test="${bug.moduleId == m.id}">
		               <input type="text"   disabled="disabled"  value="${m.name}"/>
                    </c:if>
				 </c:forEach>
				     
				</td>
			</tr>
			<tr>
			    <td><label for="expurgator">修订人：</label></td>
				<td>
				   <select name="expurgator"   disabled="disabled"  id="expurgator" style="width:153px;" >
				     <c:forEach items="${userList}" var="u" >
				            <option value="${u.enname}" <c:if test="${u.enname == bug.expurgator}">selected</c:if> ><c:out value="${u.cnname}"/></option>
				     </c:forEach>
					</select>
				</td>
			</tr>
			<tr>
				<td><label for="bugLevel">级别：</label></td>
				<td>
				    <select name="bugLevel"  disabled="disabled"  id="bugLevel" style="width:153px;">
						<c:forEach items="${bugLevelList}" var="bl">
					      <option value="${bl.value}"  <c:if test="${bl.value == bug.bugLevel}">selected</c:if>> ${bl.name}</option>
					  	</c:forEach>
				    </select>
				</td>
			</tr>
			<tr>
				<td><label for="status">状态：</label></td>
				<td>
				     <select name="status"  disabled="disabled"  id="status" style="width:153px;" >
			              <c:forEach items="${bugStatusList}" var="bs">
					         <option value="${bs.value}"  <c:if test="${bs.value == bug.status}">selected</c:if>> ${bs.name}</option>
						  </c:forEach>
					 </select>
				</td>
			</tr>
			<tr>
				<td valign="top"><label for="description">Bug描述：</label></td>
				<td valign="top"><textarea name="description"  disabled="disabled"  id="description" cols="40" rows="8"><c:out value="${bug.description}"></c:out></textarea></td>
			</tr>
			<tr>
				<td></td>
				<td>
				    <input type="button" id="btn_back" value="返回" onclick="btn_return();" style="width: 80px;" />
				</td>
			</tr>
	  </table>
    </fieldset>  
    </div>
    <div>
	<fieldset>
		   <legend>已上传文件：</legend>
			<table id="fileTable" width="900" style="border-top:dashed 1px #ddd; border-bottom: dashed 1px #ddd;" >
			  <tr>
			    <th>文件名</th>
			    <th>上传时间</th>
			    <th>提交人</th>
			    <th colspan="3">操作</th>
			  </tr>
			  <c:forEach items="${attList}" var="att" >
			      <tr align="center" >
				    <td>${att.name}</td>
					<td><fmt:formatDate value="${att.createTime}" type="both"
							dateStyle="medium" timeStyle="medium" /></td>
					<td>${att.uploadUser}</td>
					<td width="40px">
						<a href="<%=basePath%>soft/bug/download.do?fileName=${att.name}&path=${att.path}">
						下载
						</a>
					<td width="40px">  <a href="#" onclick="javascript:del(this,'${att.id}','${att.path}'); return false;">删除</a>	</td>
				    <td width="40px">
			          <c:forEach items="${pictureFormatList}" var="pf" >
					       <c:if test="${pf == att.suffix}">
					       <a href="${att.path}" class="lightbox" rel="flowers" title="${att.name}">预览</a>
					       </c:if>
					  </c:forEach>
				   </td>
				  </tr>
			  </c:forEach>
			</table>
        </fieldset>
   </div>
  </body>
</html>